package day2.dao;

import day2.entity.U;
import day2.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface UserDaoAnnotation {
    @Select("select id,name,pass,phone,address from t_user where id=#{id}")
    User selectById(Integer id);
    @Select("select id,name username,phone from t_user where id=#{id}")
    U selectUById(Integer id);

    @Select("select id,name,phone from t_user where id=#{id}")
    @Results({
            @Result(property = "username", column="name")
    })
    U selectUById2(Integer id);

    @Insert("insert into t_user(name,pass) values(#{name},#{pass})")
    void insertUser(User u);

}
